// import { ref, reactive, computed } from "vue";
import { defineStore } from "pinia";

interface BaseConfigState {
  baseUrl: string;
  // path: string;
  // params: any;
  // data: any;
  ifOnline: boolean;
}
export const useBaseConfigStore = defineStore("baseConfig", {
  state: (): BaseConfigState => ({
    ifOnline: true,
    baseUrl: "http://10.249.0.186:3000",
    // path: "",
    // params: {},
    // data: {},
  }),

  actions: {
    setBaseUrl(value: string) {
      this.baseUrl = value;
      return true;
    },
    setNetLine(val: boolean) {
      console.log("网络状态触发了", val);
      this.ifOnline = val;
    },
    // setPath(value: string) {
    //   this.path = value;
    //   return true;
    // },
    // setParams(value: any) {
    //   this.params = value;
    //   return true;
    // },
    // setData(value: any) {
    //   this.data = value;
    //   return true;
    // },
  },
  // persist: {
  //   enabled: true,
  //   strategies: [{ storage: localStorage }],
  // },
});
